/*
 * Copyright:  2018 smarabbit studio.
 *
 *  Licensed under the Confluent Community License; you may not use this file
 *  except in compliance with the License.  You may obtain a copy of the License at
 *
 *  http://www.confluent.io/confluent-community-license
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 *  WARRANTIES OF ANY KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations under the License.
 *
 *  @作   者： 黄开晖 (117227773@qq.com)
 *  @日   期:  2021年5月29日
 */
package com.massyframework.beanskin.runtime.modular.library;

import java.util.List;
import java.util.Set;

import com.massyframework.beanskin.ModuleIdentifier;
import com.massyframework.beanskin.ModuleRepository;
import com.massyframework.beanskin.RequireLibraryDescriptor;
import com.massyframework.beanskin.library.Library;
import com.massyframework.beanskin.library.LibraryBuilder;
import com.massyframework.beanskin.runtime.modular.AbstractModuleBuilder;
import com.massyframework.beanskin.service.ServiceRepositoryFactory;
import com.massyframework.beanskin.util.classloading.ModuleClassLoader;

/**
 * 类库配置构建器
 * @author huangkh
 *
 */
public final class DefaultLibraryBuilder extends AbstractModuleBuilder 
	implements LibraryBuilder{

	/**
	 * 
	 */
	public DefaultLibraryBuilder() {
	}

	@Override
	public DefaultLibraryBuilder identifier(ModuleIdentifier value) {
		super.identifier(value);
		return this;
	}

	@Override
	public DefaultLibraryBuilder name(String value) {
		super.name(value);
		return this;
	}

	@Override
	public DefaultLibraryBuilder description(String value) {
		super.description(value);
		return this;
	}
	
	@Override
	public DefaultLibraryBuilder addRequireLibrary(RequireLibraryDescriptor value) {
		super.addRequireLibrary(value);
		return this;
	}
	
	@Override
	public DefaultLibraryBuilder addTags(Set<String> value) {
		super.addTags(value);
		return this;
	}

	@Override
	public DefaultLibraryBuilder moduleRepository(ModuleRepository value) {
		super.moduleRepository(value);
		return this;
	}

	@Override
	public DefaultLibraryBuilder classLoader(ModuleClassLoader value) {
		super.classLoader(value);
		return this;
	}
	
	@Override
	public DefaultLibraryBuilder decryption(String publicKey, String x509Name, String x509Encrypted,
			List<String> classNames, List<String> scriptFileNames) {
		super.decryption(publicKey, x509Name, x509Encrypted, classNames, scriptFileNames);
		return this;
	}

	@Override
	public DefaultLibraryBuilder developer(String shortName, String name, String homePage) {
		super.developer(shortName, name, homePage);
		return this;
	}

	@Override
	public DefaultLibraryBuilder serviceRepositoryFactory(ServiceRepositoryFactory value) {
		super.serviceRepositoryFactory(value);
		return this;
	}

	@Override
	public Library build() {
		DefaultLibrary result = new DefaultLibrary(this);
		result.init();
		return result;
	}
	
}
